package xyz.zhouzhaodong.crm.controller;


import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.zhouzhaodong.crm.dto.MailDto;
import xyz.zhouzhaodong.crm.service.IMailService;
import xyz.zhouzhaodong.crm.util.NoRepeatSubmit;
import xyz.zhouzhaodong.crm.util.RestMessage;

import javax.annotation.Resource;

/**
 * <p>
 * 邮寄 前端控制器
 * </p>
 *
 * @author zhouzhaodong
 * @since 2020-06-19
 */
@RestController
@RequestMapping("/mail")
public class MailController {

    @Resource
    IMailService mailService;

    /**
     * 新增
     * @param mailDto
     * @return
     */
    @NoRepeatSubmit
    @RequestMapping("/add")
    public RestMessage addMail(MailDto mailDto){
        return mailService.addMail(mailDto);
    }

    /**
     * 删除
     * @param mailDto
     * @return
     */
    @RequestMapping("/delete")
    public RestMessage deleteMail(MailDto mailDto){
        return mailService.deleteMail(mailDto);
    }

    /**
     * 修改
     * @param mailDto
     * @return
     */
    @RequestMapping("/update")
    public RestMessage updateMail(MailDto mailDto){
        return mailService.updateMail(mailDto);
    }

    /**
     * 查询
     * @param mailDto
     * @return
     */
    @RequestMapping("/select")
    public RestMessage selectMail(MailDto mailDto){
        return mailService.selectMail(mailDto);
    }

    /**
     * 根据用户id查询
     * @param mailDto
     * @return
     */
    @RequestMapping("/selectList")
    public RestMessage selectMailList(MailDto mailDto){
        return mailService.selectMailList(mailDto);
    }

}
